package cn.lger.icollege.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Code that Changed the World
 * Pro said
 * Created by Pro on 2018-05-16.
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Value("${file.upload.path}")
    private String prefixPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/icon/**").addResourceLocations("file:"+prefixPath+"/icon/");
        registry.addResourceHandler("/file/**").addResourceLocations("file:"+prefixPath+"/download/");
    }
}
